package cn.cvs.controller;

import com.mysql.jdbc.log.Log;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.logging.Logger;

public class HelloController extends AbstractController {
    @Override
    protected ModelAndView handleRequestInternal(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception {
        System.out.println("Spring MVC框架搭建成功");
        return new ModelAndView("hello");
    }
    @Controller
    public class HelloController1{
        @RequestMapping(value = "/hello")
        public String hello(){
            System.out.println("Spring MVC框架搭建成功");
            return "hello";
        }
        @Controller
        @RequestMapping(value = "/hello")
        public class HelloController2{
            Logger logger = Logger.getLogger(String.valueOf(HelloController2.class));
            @RequestMapping(value = "/hello")
            public String hello(){
                logger.info("我的第一个SpringMVC程序,运行成功啦!");
                return "hello";
            }
            @RequestMapping(value = "hello2")
            public String hello2(){
                logger.info("hello控制器下的另一个接口!");
                return "hello";
            }
        }
    }
}
